package ouyangye.third;

public class Card {
    public static void main(String[] args) {

        String[] color = {"草花", "方片", "红桃", "黑桃"};
        String[] number = {"K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3", "2", "A"};

        String[] pokerDeck = new String[54];
        int index = 0;

        for (String c : color) {
            for (String n : number) {
                pokerDeck[index] = c + n;
                index++;
            }
        }

        pokerDeck[52] = "大王";
        pokerDeck[53] = "小王";


        String[] player1 = new String[14];
        String[] player2 = new String[14];
        String[] player3 = new String[13];
        String[] player4 = new String[13];


        int p1Idx = 0, p2Idx = 0, p3Idx = 0, p4Idx = 0;

        for (int i = 0; i < pokerDeck.length; i++) {
            String card = pokerDeck[i];
            switch (i % 4) {
                case 0:
                    player1[p1Idx] = card;
                    p1Idx++;
                    break;
                case 1:
                    player2[p2Idx] = card;
                    p2Idx++;
                    break;
                case 2:
                    player3[p3Idx] = card;
                    p3Idx++;
                    break;
                case 3:
                    player4[p4Idx] = card;
                    p4Idx++;
                    break;
            }
        }

        System.out.print("玩家1：");
        printArray(player1);

        System.out.print("玩家2：");
        printArray(player2);

        System.out.print("玩家3：");
        printArray(player3);

        System.out.print("玩家4：");
        printArray(player4);
    }


    private static void printArray(String[] arr) {
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
            if (i != arr.length - 1) {
                System.out.print(", ");
            }
        }
        System.out.println("]");
    }
}